<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>新闻</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="format-detection" content="telephone=no,email=no" />
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/homePage.css" />
	</head>
	<body> 				
		<script src="../js/mui.min.js"></script>
		<script src="../js/app.js"></script>
		<script type="text/javascript" charset="utf-8">
			 //mui初始化
			mui.init();	  			
		</script>
		<header class="mui-bar mui-bar-nav">
			    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			    <h1 class="mui-title" >新闻</h1>	
		</header>
		<div class="mui-content content">
				    
			
			<div>
				<h2 id="newsName" class="newsName">这是一个很长很长的标题,你知道么,他很长很长</h2>
				<div class="newsRemark">
					<div class="newsCompanyLogo"><img src="../images/b02.png" id="newsCompanyLogo"></div>
					<div class="newsCompanyMsg">
						<div class="newsCompanyName" id="newsCompanyName">第一家公司</div>
						<div class="newsCompanyTime" id="newsCompanyTime">2014/12/12</div>
					</div>
					<div class="goCompany">
						<a  class="mui-btn mui-btn-primary">进入</a>
					</div>
		
					
				</div>
				<div class="newsContent" id="newsContent">
						啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊
					</div>
					
			</div>
		</div>
	<script type="text/javascript">
		 
		var newsName=document.getElementById('newsName');
		var newsCompanyLogo=document.getElementById('newsCompanyLogo');
		var newsCompanyTime=document.getElementById('newsCompanyTime');
		var newsCompanyName=document.getElementById('newsCompanyName');
		var newsContent=document.getElementById('newsContent');
		mui.plusReady(function() { 
				loadPage=function(){
					var self = plus.webview.currentWebview();		
					console.log(self.newsId);
					mui.ajax(url+'homePage/GetNews',{
								dataType:'json',
								data:{
									webToken:'rqlh',
									newsId:self.newsId
								},
								type:'get',
								timeout:10000,
								success:function(data){	
									if(data.Code=='000'){
										console.log("接口成功");
										
										//新闻标题		 
										newsName.innerHTML=data.Data[0].Name;
										//公司logo
										newsCompanyLogo.src=data.Data[0].Logo;
										//发布时间
										newsCompanyTime.innerHTML=data.Data[0].Time;
										//发布公司名
										newsCompanyName.innerHTML=data.Data[0].CompanyName;
										//新闻正文
										newsContent.innerHTML=data.Data[0].Content;
									}else{
										plus.nativeUI.toast(data.Msg);
									}
									
								},
								error:function(xhr,type,errorThrown){
									plus.nativeUI.toast("连接错误,请检查网络");
									   
								}
								   
									  
					}); 
				}
				loadPage();
				mui('.mui-content').on('tap', '.c-href', function() {
						console.log("tap");
						var href=this.getAttribute('data-href').toLowerCase(),
							id;
						if(href.indexOf('product/detail/')>=0){
							id=href.split('product/detail/')[1];
							showProduct(id);
						 	
						}else if(href.indexOf('topic/detail/')>=0){
							id=href.split('topic/detail/')[1];
							himall.openVW('topic-detail.html','',{topicId:id});
							
						}else if(href.indexOf('./company')>=0){
							console.log(href);
							id=href.split('./company.html#')[1];
							console.log(id);
							himall.openVW(id,'./company.html#',{companyId:id});
							
						}
						else{
							plus.runtime.openURL(href);
							
						}
				});
				 
		});
		
	</script>
	</body>
	
</html>